<?php
    /* /app/View/Helper/LinkHelper.php */
    App::uses('AppHelper', 'View/Helper');

class PDFHelper extends AppHelper
{
  
	function ColouredTable($header,$data)
	{
		// Header
		$w = array(100,120,100,80,120);
		$num_headers = count($header);
		$tbl = '<table cellpadding="5" cellspacing="10" border="0">';
		//table heading colour
		$tbl.='<tr bgcolor="#fff">';
		for($i = 0; $i < $num_headers; ++$i)
		{
			$tbl.='<td class="heading" width="'.$w[$i].'">'.$header[$i].'</td>';
		}
		$tbl.="</tr>";

		//$fill=0;
		$rowCount=0;

		foreach($data as $row)
		{
			if($rowCount%2==0)
			{
				$tbl.='<tr valign="top" bgcolor="#ffffff">';
			}
			else
			{
				$tbl.='<tr valign="top">';
			}
			$tbl.="<td>".$row['Brands']['name']."</td>";
			$tbl.="<td>".$row['Ranges']['name']."</td>";
			$tbl.="<td>".$row['Categories']['name']."</td>";
			$tbl.="<td>".$row['Products']['size']."</td>";
			$tbl.="<td>".$row['Ordersproduct']['orderQty']."</td>";
			$tbl.="</tr>";
			$rowCount++;

		}
		$tbl.="</table>";

		return $tbl;
		//$this->Cell(array_sum($w), 0, '', 'T');
	}
}

?>